USC: A Universal Stub Compiler

ثبت نشده
چکیده

base types in any byte order. USC requires stub parameters that give the lengths of any variable length array arguments. The code below copies one variable length character array to another. len gives the current length of the arrays. void foo (len, str1, str2) int len; /* Must be a native type */ char str1[len]; /* May be native or not */ char str2(1, 4, 4, <0>)[len];/* May be native or not */ { str1 = str2; } Any USC stub that contains a variable length array definition as a parameter must have a native integer parameter whose name matches the name given in the array definition. USC supports the inline qualifier found in many C compilers. A USC stub declared as inline will generate an inline function. In addition USC supports the qualifier macro which directs USC to produce a C macro implementation of the specified stub. Currently the qualifier macro may only be used on stubs returning type void. The stub tcphdr defined in Figure 1 shows how to define a stub to copy a TCP header from network format to DecStation 5000 native format. The generated C code swaps bytes and realigns the data. Less traditional stubs can also be generated. It is often useful to read and write fields into a network header stored in network format. A stub that peeks into a TCP header in network format and returns the offset field in a four byte, big-endian, integer would be defined as follows: int(4,4,4,<3,2,1,0>) tcpgetoff (net_hdr *hdr) { return hdr->off; } USC also provides for in-place modification of a data value. The pragma alias can be used to inform USC that two parameters will be aliased every time the procedure is called. To generate a stub which is intended to do an in-place translation of a tcp header one would use the following USC stub definition: void tcphdr(net_hdr *src, native_hdr *dest) { #pragma alias(src,dest) *src = *dest; } The stub generated assumes that the parameter dest is aliased with the parameter src. On machines where the layout of network_hdr and native_hdr are the same no code will be generated. USC will generate correct code if parameters to a stub are aliased regardless of the use of the alias pragma. However, such code will not be optimal. Note that only pointers may be aliased in this way and inplace conversion between two types with different lengths …

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Using Platform-Specific Optimizations in Stub-Code Generation

The use of a stub code generator can greatly reduce the effort required to implement a multi-server system on top of a microkernel. However, stub code has traditionally been highly generic and therefore rather slow, which has prevented it from being used in performance-critical applications. In this work, we show that this restriction can be eliminated by specialization for the underlying platf...

متن کامل

Compact and Efficient Presentation Conversion Routines

Presentation conversion is a key operation in any development environment for distributed applications, such as Corba, Java-RMI, DCE or ASN.1-based environments. It is also well-known performance bottleneck in high-speed network communication. Presentation conversion code is usually generated by an automatic code generation tool referred to as stub compiler. The quality of the code generated by...

متن کامل

Injecting Management

Object Infrastructure Framework The goal of the Microelectronics and Computer Technology Corporation’s (MCC) Object Infrastructure Project (OIP) is to simplify the development and evolution of distributed, object-oriented applications. OIP is designing an architecture for distributed systems (a set of rules for distributed, component-based systems to follow) and implementing frameworks. (Such a...

متن کامل

Compact and Eecient Presentation Conversion Code

Presentation conversion is a key operation in any development environment for distributed applications, such as Corba, Java-RMI, DCE or ASN.1-based environments. It is also well-known performance bottleneck in high-speed network communication. Presentation conversion code is usually generated by an automatic code generation tool referred to as stub compiler. The quality of the code generated by...

متن کامل

Dynamic Compilation in the Unix Environment

A system for dynamic compilation under the Unix operating system is described. The basis of the system is an incremental assembler that can be used statically or during program execution to insert or replace a module in an executable image. All cross-module references are via offsets into a run-time symbol table. All generated code is independent of its location or the location of the symbol ta...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1994